Geo-triggering
Start Geo-triggering
Geo-triggering allows the automatic detection of location context change events (such as entering or exiting a geofence, or crossing a Geoline™). For this capability, the SDK needs to be initialized and the app must have location permission.
Google has announced it is removing geofencing as an approved foreground service use case, effective October 28, 2026 (policy announcement - note Google's original communication cited a later date, since accelerated). This means a FOREGROUND_SERVICE_LOCATION-typed service can no longer be justified on the basis of Geo-triggering/geofencing alone - your app must independently qualify for that foreground service type (e.g. Tempo's active navigation tracking) if it wants to keep one running.
As of SDK 19.0.0, the SDK no longer owns a foreground service for Geo-triggering. Geo-triggering always runs via a background worker (ACCESS_BACKGROUND_LOCATION), with or without a linked foreground service. Linking a foreground service is optional, but it significantly reduces location-update latency and is recommended wherever your app can do so in compliance with Google Play policy (see above). See the Migration Guide to Point SDK V19.0.0 for Android if you are upgrading from an earlier version.
To start Geo-triggering, you should create and start the GeoTriggeringService.
if (ServiceManager.getInstance(context).isBluedotServiceInitialized()) {
// The Rezolve Point SDK is initialized, you can start Geo-triggering.
GeoTriggeringService.builder()
.start(myApplicationContext, // This context should be the Application context.
{ error ->
if (error != null) {
// Something went wrong when starting Geo-triggering. Handle error here.
return@start
}
// Geo-triggering has started successfully. Handle success here.
})
} else {
// The Rezolve Point SDK is not initialized. Initialize before starting Geo-triggering.
}
Linking a foreground service for low-latency triggers
For many use cases, linking your own app-owned foreground service delivers a substantial reduction in location-update latency, making it worth implementing wherever your app can justify a foreground service under current Google Play policy. The GeoTriggerBuilder no longer accepts a notification()/notificationId() - your app must declare, start, and display the notification for its own foreground service, then call ServiceManager.getInstance(context).linkForegroundService() once that service is running.
⚠️ Per Google's updated policy (see above), geofencing alone no longer qualifies as a valid use case for a
FOREGROUND_SERVICE_LOCATION-typed service. Do not declare/run such a service solely to keep Geo-triggering linked unless your app independently qualifies for that foreground service type for another reason.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Start your own foreground service here, which links itself via
// ServiceManager.getInstance(context).linkForegroundService() in its onCreate().
startYourForegroundService(context)
}
GeoTriggeringService.builder()
.start(myApplicationContext, // This context should be the Application context.
{ error ->
if (error != null) {
// Something went wrong when starting Geo-triggering. Handle error here.
return@start
}
// Geo-triggering has started successfully. Handle success here.
})
To learn more about implementing your own foreground service check the Foreground service and persistent notification documentation
Receiving Geo-trigger events
Create a receiver in the Manifest to receive geo-trigger events (such as entering a location):
<application android:label="@string/app_name" >
<receiver
android:name="my.package.ExampleGeoTriggerReceiver"
android:enabled="true"
android:exported="false"
>
<intent-filter>
<action android:name="io.bluedot.point.GEOTRIGGER" />
</intent-filter>
</receiver>
</application>
For every Entry/Exit event generated by BluedotSDK you will receive a callback as onZoneEntryEvent/onZoneExitEvent with GeoTriggerEvent
class ExampleGeoTriggerReceiver : GeoTriggeringEventReceiver() {
override fun onZoneInfoUpdate(context: Context) {
// Notification that the local cache of zones has been updated
// and Zones can be fetched from ServiceManager getZonesAndFences() API
}
override fun onZoneEntryEvent(entryEvent: GeoTriggerEvent, context: Context) {
// Notification that a zone has been entered/Geoline™ crossed.
}
override fun onZoneDwellEvent(dwellEvent: GeoTriggerEvent, context: Context) {
// Notification that a dwell event has triggered for a zone.
}
override fun onZoneExitEvent(exitEvent: GeoTriggerEvent, context: Context) {
// Notification that an exit detection-enabled zone has been exited.
}
}
Exit events will only trigger when the device has moved a substantial distance away from the geofence. Detection of Exit events may not be as immediate as Entry events.
Stop Geo-triggering
If you only need geo-triggering for a limited period, once that period is over, you can stop the geo-trigger service.
GeoTriggeringService.stop(myContext, { error ->
if (error != null) {
// Something went wrong stopping Geo-triggering. Handle error here.
return@stop
}
// Geo-triggering stopped successfully. Handle success here.
})
Geo-triggering start and stop status are provided through callbacks on the geoTriggeringStatusListener, implemented as lambda functions in the above examples.